<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:cc="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core">

	<cc:interface>
		<cc:attribute name="widgetVar" required="true" />
		<cc:attribute name="bean" type="fr.gestproj.bean.referentiel.AbstractBeanReferentiel" />
	</cc:interface>

	<cc:implementation>
		<p:commandButton icon="ui-icon-circle-plus" />

		<p:dataTable widgetVar="#{cc.attrs.widgetVar}" value="#{cc.attrs.bean.datamodel}" var="entite" lazy="true" rows="15" selection="#{cc.attrs.bean.selection}" rowSelectMode="checkbox" paginator="true" paginatorPosition="top" sortMode="multiple">

			<p:column selectionMode="multiple" styleClass="align-center" />

			<c:forEach items="#{cc.attrs.bean.datatableColumns}" var="column">
				<p:column binding="#{column.primefacesColumn}" styleClass="align-center">
					<c:if test="#{column.filterable and column.classe.simpleName != 'String'}">
						<f:facet name="filter">
							<p:selectOneMenu rendered="#{column.classe.simpleName == 'Boolean'}" onchange="PF('#{cc.attrs.widgetVar}').filter()" converter="javax.faces.Boolean">
								<f:selectItem itemLabel="Tous" noSelectionOption="true" />
								<f:selectItem itemLabel="Oui" itemValue="true" />
								<f:selectItem itemLabel="Non" itemValue="false" />
							</p:selectOneMenu>
						</f:facet>
					</c:if>
					<h:outputText value="#{entite[column.champ]}" rendered="#{column.classe.simpleName == 'String'}" />
					<h:outputText value="#{entite[column.champ] ? 'Oui' : 'Non'}" rendered="#{column.classe.simpleName == 'Boolean'}" />
					<h:outputText value="#{entite[column.champ]}" rendered="#{column.classe.simpleName == 'Date'}">
						<f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
					</h:outputText>
				</p:column>
			</c:forEach>

		</p:dataTable>
	</cc:implementation>

</ui:composition>